//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#include "_tracTOR.h"

#include <AirFrame_m.h>

_tracTOR::_tracTOR(double par1):
    par1(par1)
{}

_tracTOR::~_tracTOR() {}

void _tracTOR::filterSignal(AirFrame *frame, const Coord& sendersPos, const Coord& receiverPos)
{
	Signal&   signal = frame->getSignal();
	simtime_t start  = signal.getReceptionStart();
	simtime_t end    = signal.getReceptionEnd();
	ev << "Filtering a signal from " << start << " to " << end << "." << endl;

	//create an appropriate mapping to represent our attenuation
	Mapping* attenuation = MappingUtils::createMapping();

	//define the attenuation (as a gain factor) in the mapping (in this case no attenuation)
	attenuation->setValue(Argument(start), 1);
	//TODO: write your own attenuation to the mapping

	//add attenuation to the signals attenuation list
	//this makes our attenuation affect the signal
	signal.addAttenuation(attenuation);
}
